<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Computed Property</title>
    <script src="../../vue.js"></script>
</head>
<body>
    <div id="app">
        <p>Price:{{price}}</p>
        <p>Numbers:{{num}}</p>
        <p>Total:{{totalPrice}}</p>
        <div>
            <button @click="num++">++</button>
            <button @click="num==0?0:num--">--</button>
        </div>


    </div>

    <script>
        var vm=new Vue({
            el:'#app',
            data:{
                price:20,
                num:0,
            },
            computed:{
                totalPrice(){
                    return this.price*this.num
                }
            }
        })
    </script>
    
</body>
</html>